export enum StatusCode {
  Success = "00000",
  Close = "00002",
  Timeout = "00003",
  FatalError = "00004",
  DeviceError = "00005",
  NoModules = "00006", // 没有模块
  InitFail = "00007", // 初始化失败

  // IDCard
  CardInvalid = "00020", // 无效卡
  CardAcceptCancelled = "00021", // 用户取消
  CardInserted = "00022", // 插入卡
  CardDataError = "00023", //身份证数据错误
  CardCancelFail = "00024",
  CardReadFail = "00025",

  // Barcode
  ReadBarcodeCancelled = "00040", // 用户取消
  BarcodeCancelFail = "00041",
  ReadBarcodeFail = "00042",

  // cam
  hStartDisplayFail = "00060", // 启动预览失败
  hStopDisplayFail = "00061", // 关闭预览失败
  hTakePictureFail = "00062", //   拍照失败

  // Prr
  PrintRawDataFail = "00081",

  // cam
  dStartDisplayFail = "00101", // 启动预览失败
  dStopDisplayFail = "00102", // 关闭预览失败
  dTakePictureFail = "00103", //   拍照失败

  // pin
  PinCancel = "000121",
  PinGetDataNoActive = "000122",

  // common
  PrinterFail = "000141", // 打印失败

  // fpc 
  FingerDetected = '000161',
  FingerTaken = '000162',
  FingerSaveSuccessful = '000163',
  FingerTemplateDeleteFail = '000164',
  FingerTemplateNoExist = '000165',
  FingerReadSuccessful = '000166',
  FingerDataNotSupport = '000167',
}

export type StatusCodeDescription = {
  [key in StatusCode]: string;
};

export const statusCodeDescription: StatusCodeDescription = {
  [StatusCode.Success]: "成功",
  [StatusCode.Close]: "关闭",
  [StatusCode.Timeout]: "超时",
  [StatusCode.FatalError]: "致命错误",
  [StatusCode.DeviceError]: "设备错误",
  [StatusCode.NoModules]: "没有模块",
  [StatusCode.InitFail]: "初始化失败",
  [StatusCode.CardInvalid]: "无效卡",
  [StatusCode.CardAcceptCancelled]: "用户取消",
  [StatusCode.CardInserted]: "插入卡",
  [StatusCode.CardDataError]: "身份证数据错误",
  [StatusCode.CardReadFail]: "身份证读取错误",
  [StatusCode.CardCancelFail]: "取消身份证读卡失败",
  [StatusCode.BarcodeCancelFail]: "取消读取二维码失败",
  [StatusCode.ReadBarcodeFail]: "读取二维码失败",
  [StatusCode.ReadBarcodeCancelled]: "用户取消",
  [StatusCode.hStartDisplayFail]: "高拍仪启动显示失败",
  [StatusCode.hStopDisplayFail]: "高拍仪关闭显示失败",
  [StatusCode.hTakePictureFail]: "高拍仪拍照失败",
  [StatusCode.PrintRawDataFail]: "打印凭条失败",
  [StatusCode.dStartDisplayFail]: "双目摄像头启动显示失败",
  [StatusCode.dStopDisplayFail]: "双目摄像头关闭显示失败",
  [StatusCode.dTakePictureFail]: "双目摄像头拍照失败",
  [StatusCode.PinCancel]: "取消密码键盘",
  [StatusCode.PinGetDataNoActive]: "密码键盘输入未激活，不需要取消",
  [StatusCode.PrinterFail]: "打印失败",
  [StatusCode.FingerDetected]: "手指按下",
  [StatusCode.FingerTaken]: "手指移开",
  [StatusCode.FingerSaveSuccessful]: "指纹保存成功",
  [StatusCode.FingerTemplateDeleteFail]: "指纹模板删除失败",
  [StatusCode.FingerTemplateNoExist]: "指纹模板不存在",
  [StatusCode.FingerReadSuccessful]: "指纹读取成功",
  [StatusCode.FingerDataNotSupport]: "指纹数据对比失败",
};



export const keyCodeMaps = {
  CANCEL: {
    keyCode: 3,
    runCount: 1
  },
  BACKSPACE: {
    keyCode: 8,
    runCount: 1
  },
  CLEAR: {
    keyCode: 12,
    runCount: 1
  },
  ENTER: {
    keyCode: 13,
    runCount: 1
  },
  HELP: {
    keyCode: 47,
    runCount: 1
  },
  '00': {
    keyCode: 48,
    runCount: 2
  },
  '0': {
    keyCode: 48,
    runCount: 1
  },
  '1': {
    keyCode: 49,
    runCount: 1
  },
  '2': {
    keyCode: 50,
    runCount: 1
  },
  '3': {
    keyCode: 51,
    runCount: 1
  },
  '4': {
    keyCode: 52,
    runCount: 1
  },
  '5': {
    keyCode: 53,
    runCount: 1
  },
  '6': {
    keyCode: 54,
    runCount: 1
  },
  '7': {
    keyCode: 55,
    runCount: 1
  },
  '8': {
    keyCode: 56,
    runCount: 1
  },
  '9': {
    keyCode: 57,
    runCount: 1
  }
};


export type KeyCodeMapKeys = keyof typeof keyCodeMaps;
export type KeyCodeMaps = {
  [s in KeyCodeMapKeys]: {
    keyCode: number;
    runCount: number;
  };
}; 